Optical scanner and software for correcting distorted images

ABSTRACT

The invention provides a scanner for scanning a surface having a one-dimensional optical sensor and no mechanical moving parts for determining the scanning speed. A method is also provided for processing a text image obtained by scanning a text with a scanner, where the text image is distorted due to variability of the instantaneous scanning speed. The method utilizes the mode character height and font ration for each font in the text obtaining a local correction factor at each location in the text image. The correction factor is related to the instantaneous scanning speed at the location and is used to correct the distorted text image.

REFERENCE TO RELATED APPLICATIONS

The present application is the national stage under 35 U.S.C. 371 ofinternational application PCT/IL00/00010, filed 6 Jan. 2000 whichdesignated the United States, and which international application waspublished under PCT Article 21(2) in the English language.

FIELD OF THE INVENTION

The present invention is in the field of text scanners and software foruse therewith.

BACKGROUND OF THE INVENTION

Hand-held optical scanners are used in a variety of applicationsincluding text scanning, barcode reading, and picture grabbing. Thesescanners comprise an optical sensor for acquiring image information thatis managed by a central processing unit (CPU) and stored in a memory.The information is typically processed by character recognition softwareand then sent to a user application such as a word processor, databaseor spreadsheet.

The viewing area of hand-held scanners at a given it includes only asmall portion of the entire scanned medium. Thus in use, a hand-heldscanner is made to pass over the entire scanned medium so as to producea time series of acquired images where each acquired image correspondsto a small portion of the scanned medium. Since the images are acquiredat a constant rate, subsequent reconstruction of the scanned medium fromthe series of acquired images produces a distorted image due tovariation in the scanning speed during scanning. A hand held scanner hasa reference scanning speed at which the acquired image is identical tothe original. The reference scanning speed is the product of the width(in the scanning direction) of the optical sensor and the rate at whichimages are acquired by the sensor. Locations in the scanned mediumacquired when the scanning speed is below the reference speed appear tobe stretched or expanded, while locations acquired when the scanningspeed is above the reference speed appear compressed. Such distortedimages may not be recognizable by character recognition software. Eachacquired image must thus be processed by rescaling it in the scanningdirection by a correction factor equal to the instantaneous scanningspeed divided by the reference speed. Prior art scanners thereforecomprise means for continuously monitoring the instantaneous scanningspeed. U.S. Pat. No. 5,083,218, for example, discloses a hand-heldscanner comprising a wheel that rolls along the scanned medium duringscanning for measuring the instantaneous speed at every moment duringthe scanning. U.S. Pat. No. 5,023,922 discloses a hand-held scanner witha 2-dimensional optical sensor in which the instantaneous speed iscalculated from the time interval required for an image to traverse thesensor. The presence of a wheel or a two dimensional sensor makes thehand held scanner bulky and awkward to use.

There is therefore a need in the art to provide a scanner thatsubstantially reduces or overcomes the disadvantages of prior artscanners.

Glossary

There follows a glossary of terms used in the following description andset of claims together with their definitions, some of them known in theart, others having been coined.

Field of view—the portion of the scanned medium acquired by a scanner atone instant.

Scanned image—a two-dimensional image created by moving a scanner over asurface. The scanned image is compiled from the time series of fields ofview acquired during scanning.

Text image—A scanned image composed of text in any language.

Cluster—A contiguous group of black pixels in a text image. A blackcluster is typically a single character but may be a portion of a singlecharacter, or a union of two or more characters.

Horizontal segment—A line of contiguous black pixels parallel to thetext line, one pixel high. The length of a horizontal segment is thenumber of its black pixels.

Stack—A contiguous array of at least a predetermined number ofhorizontal segments in a scanned image with the following properties:

-   -   (a) No two of the horizontal segments are collinear.    -   (b) The ratio of the length of the longest horizontal segment in        the stack to that of the shortest horizontal segment does not        exceed a predetermined value.    -   (c) adjacent horizontal segments in the stack at least partially        overlap (i.e. in a given pair of adjacent horizontal segments in        the stack, there is at least one black pixel in each of the two        horizontal segments acquired from the same field of view).        Each stack has associated with it a height that may be defined,        for example, as the number of its composite horizontal segments.        Each stack also has associated with it a width that may be        defined, for example, as the average length of its horizontal        composite segments, the minimal length of its horizontal        composite segments, or the length of an arbitrary one of its        horizontal segments. The invention is not to be considered as        being bound by these definitions, and other definitions of        height and width are contemplated within the scope of the        invention. Each stack also has associated with it a bounding        rectangle of minimum dimensions in which two opposite sides are        vertical and two opposite sides are horizontal.

Essentially vertical stack—A stack whose height exceeds a predeterminednumber in which the ratio of the width of the stack to the width of itsbounding rectangle exceeds a predetermined value.

Character recognition software—Any software package for converting atext image into a string of ASCII characters, for example OpticalCharacter Recognition (OCR) software.

Stop interval—A series of consecutive fields of view, the number ofwhich exceed a predetermined number, all of which are nearly identicalto the first field of view. Two fields of view are considered to benearly identical if there does not exist in one of the fields of view asubfield of contiguous pixels of length greater than a predeterminedlength in which all of the pixels are different from the correspondingpixels in the other field of view.

Font ratio—the ratio of the mode character height (the most commoncharacter height) to the most common essentially vertical line width ofthe characters in a particular font. The font ratio is a characteristicconstant of a given font. For most fonts, the font ratio is typically,although not necessarily, around 6.

Correction factor—the instantaneous scanning speed divided by thereference speed.

SUMMARY OF THE INVENTION

In the following description and set of claims, the direction of thetext line as well as the scanning direction of a hand held scanner isarbitrarily designated as the horizontal direction. This designation isbeing made only for the sake of simplicity in describing the invention.Other scanning directions are also contemplated within the scope of theinvention and the invention is not to be considered as being bound bythis arbitrary designation.

In its first aspect, the present invention provides a scanner having aone-dimensional (linear) optical sensor that creates an image one pixelwide and n pixels in length (height), and not having mechanical movingparts such as a wheel. A series of scanned images is acquired at aconstant rate determined by an internal clock inside the scanner whenthe scanner's sensor array is moved over a surface so as to scan a lineof symbols. Image information obtained by the sensor may be stored andprocessed in a computer processing unit.

In its second aspect the present invention provides a method fordetermining the instantaneous correction factor of a text image duringscanning by a hand held scanner. Since the instantaneous correctionfactor is equal to the instantaneous scanning speed divided by thereference speed of the scanner, the method is equivalent to a method fordetermining the instantaneous scanning speed. The method may be usedwith a scanner not having any mechanical moving parts. It may also beused with scanners having only a one-dimensional optical sensor. Themethod of the invention may be used for removing distortions in a textimage due to variation in the scanning speed in order to make the textrecognizable by optical character recognition software or readable as animage by a user.

The method of the invention is based upon the observation that in ascanned image, vertical distances (i.e. distances perpendicular to thescanning direction) at any particular location are independent of theinstantaneous scanning speed at that location. In particular, in a textimage, the height of a text character is independent of the scanningspeed. The mode character height in a text image is thereforeindependent of any variability in the scanning speed during acquisitionof the text image. As disclosed below, the instantaneous scanningvelocity, or equivalently the instantaneous correction factor, at alocation in a text image comprising an essentially vertical stack can bedetermined from the width of the essentially vertical stack, the modecharacter height of the scanned text, and the font ratio.

The invention thus provides a scanner for scanning a surfacecharacterized in that it has a one-dimensional optical sensor and has nomechanical moving parts for determining the scanning speed.

The invention also provides a method for processing an acquired textimage obtained by scanning a text with a scanner, the text having one ormore fonts, each font having a font ratio, each location in the texthaving been scanned at an instantaneous scanning speed, where the textimage is distorted due variability of the instantaneous scanning speed,the method comprising the following steps:

-   -   (a) Providing a mode character height for each font; and    -   (b) utilizing said mode character height and font ratio for        constructing a correction factor in order to correct the        distorted text image.

The invention further provides a storage medium storing an executablecomputer program for processing an acquired text image obtained byscanning a text with a scanner, the text having one or more fonts, eachfont having a font ratio, each location in the text having been scannedat an instantaneous scanning speed, where the text image is distorteddue variability of the instantaneous scanning speed, the processingcomprising the following steps:

-   -   (a) Providing a mode character height for each font; and    -   (b) utilizing said mode character height and font ratio for        constructing a correction factor in order to correct the        distorted text image.

BRIEF DESCRIPTION OF THE DRAWINGS

In order to understand the invention and to see how it may be carriedout in practice, a preferred embodiment will now be described, by way ofnon-limiting example only, with reference to the accompanying drawings,in which:

FIG. 1 shows a hand-held scanner according to the invention;

FIG. 2 shows a block diagram of the processing carried out according tothe invention;

FIG. 3 shows 7 characters resolved into 8 clusters;

FIG. 4, a and b each show a cluster decomposed into horizontal segments;

FIG. 5 a shows a line of text to be scanned;

FIG. 5 b shows a text image obtained by scanning the line of text ofFIG. 5 a with a hand-held scanner;

FIG. 6 shows a flow chart for determining the instantaneous scanningspeed according to the invention;

FIG. 7 a–c show parts of an acquired text image; and

FIG. 8 shows the acquired text image of FIG. 7 after correction inaccordance with the invention.

DETAILED DESCRIPTION OF A PREFERRED EMBODIMENT

In its first aspect, the present invention provides a scanner having aone-dimensional optical sensor and not having mechanical moving partssuch as a wheel. As shown in FIG. 1, the scanner, generally designatedas 1, has a one-dimensional optical sensor 2, a handle 3 for grasping,and no mechanical moving parts. A series of scanned images is acquiredby moving the sensor 2 over a surface. FIG. 2 is a block diagram of asystem comprising a one-dimensional scanner and a processor according tothe invention. The sensor 2 is used to scan a line of symbols. Thesensor is linked to the input port of central processing unit 12. Theinput function is managed by a CPU 14. Image information 16 obtained bysensor 10 may be stored by the CPU in a memory 18. The structure of thesystem of the invention is not bound to the specific architecturedepicted in FIG. 2.

In its second aspect the present invention provides a method fordetermining the instantaneous correction factor of a text image duringscanning by a hand held scanner. The method may be used with a scannernot having any mechanical moving parts. It may also be used withscanners having only a one-dimensional optical sensor. The method of theinvention may be used for removing distortions due to variation in thescanning speed in the text image 16 acquired by the sensor 2 in order tomake the text recognizable by character recognition software or by auser. The method, to be described below in detail, is carried out by anapplication 20 that processes the image either in real time or off-linein respect of image a priori stored in memory 18. The results of theprocessing may optionally be processed by character recognition softwarebefore being returned to the CPU or sent to interface 22.

Referring now to FIG. 3, 7 characters are shown resolved into eightclusters. Clusters 31, 35 and 38 each form an entire character (e, c ande, respectively). Cluster 32 is a union of two characters (ff). Clusters33, 34, 36 and 37 each contain a part of a character (i).

FIG. 4 shows two clusters divided into composite pixels. In FIG. 4 a,horizontal line 49, for example, has a length of 6 (pixels), andhorizontal line 40 has a length of 8. Stack 42 has a height of 12. Ifhorizontal line 40 were to be added to stack 42, the resulting compositestructure would not be a stack because the ratio of the length of thelongest horizontal segment (8) to that of the shortest horizontalsegment (5) in the structure would exceed a typical predetermined valueof 1.3. Two of the twelve horizontal lines constituting stack 42designated as 45 a and 45 b have a length of 5, while the other ten havea length of 6. The width of stack 42 (the average length of itshorizontal lines) is thus calculated to be 5.83. In FIG. 4 b stack 43has a height of 6 and a width of 28, which is equal to the clusterwidth. Stack 43 is not considered to be an essentially vertical stackbecause its height does not exceed a typical predetermined value ofabout 8. Stack 44 is composed of 13 horizontal line segments of lengthsof 5–6. In this stack, there is no overlap between the lowest 46 andhighest 47 horizontal line segments. Stack 44 is also not an essentiallyvertical stack because the ratio of its width (6.3) to the width of itsbounding rectangle 48 (12) does not exceed a typical predetermined valueof about 0.75. The above mentioned predetermined values used inreference to the clusters of FIG. 4, are by way of example only, and theinvention is not bound by these predetermined values.

FIG. 5 a shows a line of text to be scanned. Arrows 56 indicate the modecharacter height, and arrows 57 show the most common vertical linewidth. In some fonts, essentially vertical lines are slightly slantedfrom a true vertical position. The ratio of the mode character height 56to the most common essentially vertical line width 57 (the font ratio)is a characteristic constant of the font.

FIG. 5 b shows a typical text image obtained by scanning the text linein FIG. 5 a with a hand-held scanner. The text appears distorted due tovariation in the scanning speed. Character widths are inverselyproportional to the scanning speed. As can be seen by comparing thewidth of characters 50 and 51 in the original text (FIG. 5 a) with theirimages in the text scan (FIG. 5 b), in interval 54 the instantaneousscanning speed was greater than the reference speed of the scanner,while in interval 55 the instantaneous scanning speed was below thereference speed. Vertical line widths, for example that of vertical line59, are also inversely proportional to the scanning speed. The modecharacter height 56, however, is unaffected by the variability in thescanning speed and is the same in FIGS. 5 a and 5 b. Horizontal linewidths, for example that of line 58, are also unaffected by variationsin scanning speed. Interval 52 is a typical stop segment.

FIG. 6 shows a flow chart describing the method in accordance with oneembodiment of the invention for determining the instantaneous correctionfactor at different locations in an acquired text image such as the oneshown in FIG. 7. The font ratio for the font of the text from which theacquired text image shown in FIG. 7 was obtained is, by this example,about 6. The mode height of the text characters is determined 60, which,as stated above, is independent of any variability in the scanningspeed. The mode character height of the acquired text shown in FIG. 7 isindicated by double arrow 70 and is equal, by this example, to 26pixels. A reference width is calculated 61 which is equal to the modecharacter height divided by the font ratio. For the text image of FIG.7, the reference width is thus calculated to be 26/6, or 4.3 pixels.Since the font ratio is defined as the ratio of the mode characterheight to the most common essentially vertical line width of thecharacters comprising the font, the reference width is the expectedwidth of an essentially vertical stack when the scanning speed is equalto the reference speed. All essentially vertical stacks in the textimage are then identified 63. Numerals 71–91 indicate all of the 21essentially vertical stacks in FIG. 7. The widths of the essentiallyvertical stacks are determined 64. Essentially vertical stacks having awidth greater than the reference width are those where the instantaneousscanning speed was below the reference speed of the scanner. Essentiallyvertical stacks having a width less than the reference speed are thosewhere the instantaneous scanning speed was above the reference speed ofthe scanner. The correction factor at an image comprising an essentiallyvertical stack acquired when the scanning speed was below the referencespeed is then obtained 65 by dividing the reference width by the widthof the essentially vertical stack. For example, for essentially verticalstack 86, whose width is greater than the reference width, thecorrection factor is thus calculated to be 4.3/5.5, or 0.8. Thecorrection factor at an image comprising an essentially vertical stackacquired when the scanning speed was above the reference speed is 1.

The invention also provides for determining the correction factor at astop segment in an acquired text image. A stop segment 102 is seen inFIG. 7. In stop segment 102, all of the fields of view are nearlyidentical to the first field of view in the segment, which is indicativeof a location in the acquired text image where the scanning speed wasclose to 0. Stop segment 102 is divided into a predetermined number ofcontiguous subsegments 66. In FIG. 7, stop segment 102 was divided into4 subsegments. In each subsegment, at least one, but not all, of theconsecutive fields of views is then deleted from the subsegment 67. Forexample, if all of the fields of view are deleted from each subsegmentexcept for one, then stop segment 102 would appear as segment 802 inFIG. 8. The correction factor in a stop segment is a predeterminedvalue, for example, 0.1, which indicates that the instantaneous scanningspeed in the stop segment was very slow.

Reverting to FIG. 6, the correction factor at a location not comprisingan essentially vertical stack and not comprising a stop segment that hasbeen processed as above, is determined by one of the following methods68. (i) Two essentially vertical stacks are found flanking the locationon different sides. The correction factor is then determined at thelocation between the two essentially vertical stacks by interpolation ofthe correction factors at the two flanking essentially vertical stacks.(ii) Two stop segments are found flanking the location on differentsides. The correction factor is then determined at the location betweenthe two stop segments by interpolation of the correction factors at thetwo flanking stop segments. (iii) A stop segment and an essentiallyvertical stack are found flanking the location on different sides. Thecorrection factor is then determined at the location between the stopsegment and the essentially vertical stack by interpolation of thecorrection factors at the stop segment and the essentially verticalstack.

Once the correction factors during scanning of the text have beendetermined, the text image is rectified for distortions arising fromvariation in the scanning speed 69. This is accomplished by deletingfields of view at each location where the correction factor is less thanone so as to achieve a resealing equal to the correction factor, as isknown per se. When an essentially vertical stack is rectified in thisway, it resembles the essentially vertical line in the text image whichit represents in the scanned image. FIG. 8 shows the acquired text imageshown in FIG. 7 after having been corrected.

While the invention has been described with a certain degree ofparticularity, it will be immediately apparent to those versed in theart that the method may be varied without departing from the scope ofthe invention. In particular, the order in which the steps of the methodmay be carried out may be changed without departing from the scope ofthe invention as defined in the following claims.

1. A method for processing an acquired text image obtained by scanning atext with a scanner, the text having one or more fonts, each font havinga font ratio, each location in the text having been scanned at aninstantaneous scanning speed, where the text image is distorted due tovariability of the instantaneous scanning speed, the method comprisingthe following steps: (a) providing a mode character height for eachfont; and (b) utilizing said mode character height and font ratio forconstructing a correction factor in order to correct distortions in thetext image due to scanning speed variations.
 2. The method of claim 1for determining the instantaneous correction factor at one or moreessentially vertical stacks in an acquired text image, the essentiallyvertical stacks having widths, wherein said step (b) further includesutilizing the widths of one or more essentially vertical stacks in theacquired text image.
 3. A method according to claim 2 comprising thesteps of: (a) determining the mode character height of the scanned text;(b) calculating a reference line width by dividing the mode characterheight by the font ratio; (c) determining the height and width of theone or more essentially vertical stacks; (d) calculating aninstantaneous correction factor for any one of the one or moreessentially vertical stacks by dividing the reference width by the widthof the essentially vertical stack to obtain the instantaneous correctionfactor at the essentially vertical stack; and (e) setting the correctionfactor equal to one when the correction factor calculated according tostep (d) is greater than one.
 4. The method of claim 3, furthercomprising the steps of: (a) partitioning one or more stop segments intoa predetermined number of subsegments of consecutive fields of view; and(b) deleting from each subsegment at least one, but not all, of thefields of view in the subsegment.
 5. The method of claim 4 furthercomprising the step of calculating an instantaneous correction factor inone or more stop segments wherein the instantaneous correction factor ina stop segment is a predetermined value.
 6. A method for calculating aninstantaneous correction factor at a location in an acquired text imagenot comprising an essentially vertical stack and not comprising a stopsegment that has been corrected according to the method of claim 5,wherein the method comprises either: (a) identifying essentiallyvertical stacks flanking the location on different sides; calculatingthe instantaneous correction factor at each one of the two essentiallyvertical stacks by: (i) providing a mode character height for each font;and (ii) utilizing said mode character height and font ratio forconstructing a correction factor in order to correct distortions in thetext image due to scanning speed variations, and calculating theinstantaneous correction factor at said location by interpolation of theinstantaneous correction factors of the essentially vertical stacks; (b)identifying a subsegment in each of two stop segments flanking thelocation on different sides, calculating the instantaneous correctionfactor at each one of the two subsegments by the method of claim 5, andcalculating the instantaneous correction factor at said location byinterpolation of the instantaneous correction factors of thesubsegments; or (c) identifying an essentially vertical stack and asubsegment of a stop segment flanking the location on different sides,calculating the instantaneous correction factor at the essentiallyvertical stack by: (i) providing a mode character height for each font;and (ii) utilizing said mode character height and font ratio forconstructing a correction factor in order to correct distortions in thetext image due to scanning speed variations, calculating theinstantaneous correction factor at the subsegment by the method of claim5 and calculating the instantaneous correction factor at said locationby interpolation of the instantaneous correction factors of theessentially vertical stack and the stop segment.
 7. A method forremoving distortions at one or more locations in an acquired text imagedue to variation in the scanning speed during scanning of a text, themethod comprising the steps of: (a) calculating the instantaneouscorrection factor at the one or more locations in the text image by themethod of claim 2 and (b) deleting fields of view at each of the one ormore locations where the correction factor is less than one so as toproduce a rescaling of the acquired text image at each location by afactor substantially equal to the instantaneous correction factor ateach location.
 8. The method of claim 7 further comprising the step ofprocessing the text image by character recognition software.
 9. A systemfor processing a text comprising: (a) a scanner having a one-dimensionaloptical sensor and no mechanical parts for determining scanning speed;and (b) a CPU coupled to a storage medium and executing software forcarrying out the method according to claim
 1. 10. A storage mediumstoring an executable computer program for processing an acquired textimage obtained by scanning a text with a scanner, the text having one ormore fonts, each font having a font ratio, each location in the texthaving been scanned at an instantaneous scanning speed, where the textimage is distorted due variability of the scanning speed, the processingcomprising the following steps: (a) providing a mode character heightfor each font; and (b) utilizing said mode character height and fontratio for constructing a correction factor in order to correctdistortions in the text image due to scanning speed variations.
 11. Thestorage medium of claim 10 storing an executable computer program fordetermining the instantaneous correction factor at one or moreessentially vertical stacks in an acquired text image, the essentiallyvertical stacks having widths, wherein said step (b) further includesutilizing the widths of one or more essentially vertical stacks in theacquired text image.
 12. The storage medium according to claim 11wherein the processing comprises the steps of: (a) determining the modecharacter height of the scanned text; (b) calculating a reference linewidth by dividing the mode character height by the font ratio; (c)determining the height and width of the one or more essentially verticalstacks; (d) calculating an instantaneous correction factor for any oneof the one or more essentially vertical stacks by dividing the referencewidth by the width of the essentially vertical stack to obtain theinstantaneous correction factor at the essentially vertical stack. 13.The storage medium of claim 12, wherein the processing furthercomprising the steps of: (a) partitioning one or more stop segments intoa predetermined number of subsegments of consecutive fields of view; and(b) deleting from each subsegment at least one, but not all, of thefields of view in the subsegment.
 14. The storage medium of claim 13wherein the processing further comprises calculating an instantaneouscorrection factor in one ore stop segments wherein the instantaneouscorrection factor for a stop segment is a predetermined value.
 15. Thestorage medium of claim 14 wherein the processing further comprisescalculating an instantaneous correction factor at a location in anacquired text image not comprising an essentially vertical stack and notcomprising a subsegment of a stop segment that has been corrected,wherein the processing comprises either: (a) identifying essentiallyvertical stacks flanking the location on different sides; calculatingthe instantaneous correction factor at each one of the two essentiallyvertical stacks by: (i) providing a mode character height for each font;and (ii) utilizing said mode character height and font ratio forconstructing a correction factor in order to correct distortions in thetext image due to scanning speed variations, and calculating theinstantaneous correction factor at said location by interpolation of theinstantaneous correction factors of the essentially vertical stacks; (b)identifying a subsegment in each of two stop segments flanking thelocation on different sides, calculating the instantaneous correctionfactor at each one of the two subsegments, and calculating theinstantaneous correction factor at said location by interpolation of theinstantaneous correction factors of the subsegments; or (c) identifyingan essentially vertical stack and a subsegment of a stop segmentflanking the location on different sides, calculating the instantaneouscorrection factor at the essentially vertical stack by: (i) providing amode character height for each font; and (ii) utilizing said modecharacter height and font ratio for constructing a correction factor inorder to correct distortions in the text image due to scanning speedvariations, calculating the instantaneous correction factor at thesubsegment and calculating the instantaneous correction factor at saidlocation by interpolation of the instantaneous correction factors of theessentially vertical stack and the stop segment.
 16. A storage mediumstoring an executable computer program for processing an acquired textimage to remove distortions at one or more locations in the acquiredtext image due to variation in the scanning speed during scanning of atext, the processing comprising the steps of: (a) calculating theinstantaneous correction factor at the one or more locations in the textimage by the method of claim 1; and (b) deleting fields of view of eachof the one or more locations where the correction factor is less thanone so as to produce a resealing of the acquired text image at eachlocation by a factor substantially equal to the instantaneous correctionfield at each location.
 17. The storage medium of claim 16 forprocessing the text image by character recognition software.